package cn.chinahadoop.scala

class ApplyTest{
  def apply() = "APPLY"
  def test{
    println("tset")
  }
}

object ApplyTest{
  var count = 0
  
  def apply() = new ApplyTest
  
  def static{
    println("i'm a static method")
  }
  
  def incr = {
    count = count + 1
  }
  
}

class Basic4 {
  
}

/**
 * 类名+括号  调用的是object的apply方法
 * 对象+括号 调用的是类的Apply方法
 */
object Basic4 extends App{
  //ApplyTest.static
//  val a = ApplyTest()
//  a.test
//  val t = new ApplyTest
//  println(t())
//  println(t)
  
  for(i <-1 to 10){
    ApplyTest.incr
  }
  println(ApplyTest.count)
}